#include"vector.h"
#include<string>
using namespace std;
using namespace qiangsir;

void test1()
{
	vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	print_vector(v);
	v.insert(v.begin() + 1, 5);
	v.insert(v.begin() + 2, 5);
	print_vector(v);
	v.erase(v.end()-1);
	print_vector(v);

}
void test2()
{
	initializer_list<int> it = { 1,2,3,4,5 };
	for (auto e : it)
	{
		e += 1;
		cout << e << " ";
	}
	int arr[10] = { 1,2,3,4,5 };
	
}
void test3()
{
	string s1("asdfgg");
	vector<int> v1;
	v1.push_back(1);
	v1.push_back(2);
	v1.push_back(3);
	v1.push_back(4);
	v1.push_back(5);
	auto x = { 1,2,3,4,5 };
	vector<int> v2(x);
	vector<int> v3(v2);
	vector<int> v4 = v3;
	vector<int> v5(s1.begin() + 1, s1.end() - 1);
	print_vector(v1);
	print_vector(v2);
	print_vector(v3);
	print_vector(v4);
	print_vector(v5);
	
}
void test4()
{
	vector<int> v{ 1,2,3,5,6,6,6,6,7,8 };
	print_vector(v);
	vector<int>::iterator it = v.begin();
	while (it != v.end())
	{
		if (*it % 2 == 0)
		{
			it = v.erase(it);
		}
		else it++;
	}
	print_vector(v);

}
int main()
{
	test4();
	test1();
	test2();
	test3();
	return 0;
}